class DeleteSql:
    '''
    info_renovation(专项整治表)
    info_renovation_annex (专项整治附件表)
    info_renovation_operation_log(专项整治流转记录表)
    info_renovation_operator(专项整治人员表)
    info_renovation_work_log(专项整治工作日志表)
    info_renovation_work_log_template(专项整治工作日志模版表)
    info_work_log_relation_user(专项整治工作日志关联人员表)
    '''
    # 专项整治相关表
    delete_info_work_log_relation_user = 'DELETE lru FROM info_work_log_relation_user lru ' \
                                         'JOIN info_renovation r ON lru.renovation_id = r.id ' \
                                         'JOIN info_employee e ON r.creator = e.user_id ' \
                                         'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    delete_info_renovation_work_log_template = 'DELETE wlt FROM info_renovation_work_log_template wlt ' \
                                               'JOIN info_renovation r ON wlt.renovation_id = r.id ' \
                                               'JOIN info_employee e ON r.creator = e.user_id ' \
                                               'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    delete_info_renovation_work_log = 'DELETE wl FROM info_renovation_work_log wl ' \
                                      'JOIN info_renovation r ON wl.renovation_id = r.id ' \
                                      'JOIN info_employee e ON r.creator = e.user_id ' \
                                      'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    delete_info_renovation_operator = 'DELETE o.* FROM info_renovation_operator o ' \
                                      'JOIN info_renovation r ON o.renovation_id = r.id ' \
                                      'JOIN info_employee e ON r.creator = e.user_id ' \
                                      'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    delete_info_renovation_operation_log = 'DELETE l FROM info_renovation_operation_log l ' \
                                           'JOIN info_renovation r ON l.renovation_id = r.id ' \
                                           'JOIN info_employee e ON r.creator = e.user_id ' \
                                           'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    delete_info_renovation_annex = 'DELETE a FROM info_renovation_annex a ' \
                                   'JOIN info_renovation r ON a.renovation_id = r.id ' \
                                   'JOIN info_employee e ON r.creator = e.user_id ' \
                                   'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    delete_info_renovation = 'DELETE r FROM info_renovation r ' \
                             'JOIN info_employee e ' \
                             'ON r.creator = e.user_id ' \
                             'WHERE e.username="kobekq1" OR e.username="kobekq2";'

    # -----------------------------------------------------------------
    # 事件相关表
    # 英得案件状态同步表
    delete_info_law_case_status = 'DELETE lcs FROM info_law_case_status lcs ' \
                                  'JOIN info_case_log cl ON lcs.event_log_id=cl.id  ' \
                                  'JOIN info_case c ON cl.case_id = c.id ' \
                                  'JOIN info_employee e ON c.creator=e.user_id ' \
                                  'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 事件和大小类关联表
    delete_info_case_type = 'DELETE ct FROM info_case_type ct ' \
                            'JOIN info_case c ON ct.case_id = c.id ' \
                            'JOIN info_employee e ON c.creator=e.user_id ' \
                            'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 事件用户星标表
    delete_info_case_user_star = 'DELETE c FROM  info_case_user_star c ' \
                                 'JOIN info_employee e ON c.user_id=e.user_id ' \
                                 'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 事件当事人表
    delete_info_case_suspect_user = 'DELETE c FROM info_case_suspect_user c ' \
                                    'JOIN info_employee e ON c.creator=e.user_id ' \
                                    'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_case_resource	事件资源表
    delete_info_case_resource = 'DELETE cr FROM info_case_resource cr ' \
                                'JOIN info_case c ON cr.case_id = c.id ' \
                                'JOIN info_employee e ON c.creator=e.user_id ' \
                                'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_case_operator	操作用户表
    delete_info_case_operator = 'DELETE co FROM info_case_operator co ' \
                                'JOIN info_case c ON co.case_id = c.id ' \
                                'JOIN info_employee e ON c.creator=e.user_id ' \
                                'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_case_log_muck_truck
    delete_info_case_log_muck_truck = 'DELETE clmt FROM info_case_log_muck_truck clmt ' \
                                      'JOIN info_case c ON clmt.case_id = c.id ' \
                                      'JOIN info_employee e ON c.creator=e.user_id ' \
                                      'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_case_log_merchant
    delete_info_case_log_merchant = 'DELETE clm FROM info_case_log_merchant clm ' \
                                    'JOIN info_case c ON clm.case_id = c.id ' \
                                    'JOIN info_employee e ON c.creator=e.user_id ' \
                                    'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_case_log	日志表
    delete_info_case_log = 'DELETE cl FROM  info_case_log cl ' \
                           'JOIN info_case c ON cl.case_id = c.id ' \
                           'JOIN info_employee e ON c.creator=e.user_id ' \
                           'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_case_image	图片视频附件表
    delete_info_case_image = 'DELETE ci FROM info_case_image ci ' \
                             'JOIN info_case c ON ci.case_id = c.id ' \
                             'JOIN info_employee e ON c.creator=e.user_id ' \
                             'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_case_alarms	告警表
    delete_info_case_alarms = 'DELETE a FROM info_case_alarms a ' \
                              'JOIN info_case c ON a.case_id = c.id ' \
                              'JOIN info_employee e ON c.creator=e.user_id ' \
                              'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # info_event_category_event_type 事件关联事件类型表
    delete_info_event_category_event_type = 'DELETE ecet  FROM info_event_category_event_type ecet ' \
                                            'JOIN info_case c ON ecet.case_id = c.id JOIN info_employee e ' \
                                            'ON c.creator=e.user_id ' \
                                            'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_case	事件表
    delete_info_case = 'DELETE c FROM info_case c ' \
                       'JOIN info_employee e ON c.creator=e.user_id ' \
                       'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # --------------------------------------------------------------------------
    # 事件流程相关
    # info_law(法律法规表)
    delete_info_law = 'DELETE l FROM info_law l ' \
                      'JOIN info_employee e ON l.creator=e.user_id ' \
                      'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_r_event_category_law(事件类型-法律法规关联表)
    delete_info_r_event_category_law = 'DELETE cl FROM info_r_event_category_law cl ' \
                                       'JOIN info_employee e ON cl.creator=e.user_id ' \
                                       'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_event_category(事件类型维护)
    delete_info_event_category = 'DELETE c FROM  info_event_category c ' \
                                 'JOIN info_employee e ON c.creator=e.user_id ' \
                                 'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # ----------------------------------------------------------------
    # 流程管理相关sql
    # info_process_step_extra(流程信息额外表)
    delete_info_process_step_extra = 'DELETE se FROM info_process_step_extra se ' \
                                     'JOIN info_grid_process p ON se.process_id = p.id ' \
                                     'JOIN info_employee e ON p.creator=e.user_id ' \
                                     'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_r_user_grid_process(流程用户关联表)
    delete_info_r_user_grid_process = 'DELETE ugp FROM info_r_user_grid_process ugp ' \
                                      'JOIN info_grid_process p ON ugp.process_id = p.id ' \
                                      'JOIN info_employee e ON p.creator=e.user_id ' \
                                      'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_r_grid_process_event_type(流程案件关联表)
    delete_info_r_grid_process_event_type = 'DELETE pet FROM info_r_grid_process_event_type pet ' \
                                            'JOIN info_grid_process p ON pet.process_id = p.id ' \
                                            'JOIN info_employee e ON p.creator=e.user_id ' \
                                            'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_grid_process_step(流程阶段表)
    delete_info_grid_process_step = 'DELETE ps FROM info_grid_process_step ps ' \
                                    'JOIN info_grid_process p ON ps.process_id = p.id ' \
                                    'JOIN info_employee e ON p.creator=e.user_id ' \
                                    'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_grid_process(网格流程关联表)
    delete_info_grid_process = 'DELETE p FROM info_grid_process p ' \
                               'JOIN info_employee e ON p.creator=e.user_id ' \
                               'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # 删除网格相关的表
    # -- (网格视频源关联表)
    delete_info_r_grid_resource = 'DELETE gr FROM info_r_grid_resource gr ' \
                                  'JOIN info_grid g ON gr.grid_id=g.id ' \
                                  'JOIN info_employee e ON g.creator=e.user_id ' \
                                  'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # -- info_r_grid_process(流程和网格关联表)
    delete_info_r_grid_process = 'DELETE gp FROM info_r_grid_process gp ' \
                                 'JOIN info_grid g ON gp.grid_id=g.id ' \
                                 'JOIN info_employee e ON g.creator=e.user_id ' \
                                 'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # info_r_user_grid(网格用户关联表)
    delete_info_r_user_grid = 'DELETE ug FROM info_r_user_grid ug ' \
                              'JOIN info_grid g ON ug.grid_id=g.id ' \
                              'JOIN info_employee e ON g.creator=e.user_id ' \
                              'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 删除网格-- (网格表)
    delete_info_grid = 'DELETE g FROM info_grid g ' \
                       'JOIN info_employee e ON g.creator=e.user_id ' \
                       'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # ---------------------------------------------
    # 商户相关
    # 商户关联视频源
    delete_info_r_business_resource = 'DELETE br FROM info_r_business_resource br ' \
                                      'JOIN info_business b ON br.business_id=b.id ' \
                                      'JOIN info_employee e ON b.creator=e.user_id ' \
                                      'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # 商户附件
    delete_info_r_business_image = 'DELETE bi FROM info_r_business_image bi ' \
                                   'JOIN info_business b ON bi.business_id=b.id ' \
                                   'JOIN info_employee e ON b.creator=e.user_id ' \
                                   'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 商户关联事件
    delete_info_r_business_case = 'DELETE bc FROM info_r_business_case bc ' \
                                  'JOIN info_business b ON bc.business_id=b.id ' \
                                  'JOIN info_employee e ON b.creator=e.user_id ' \
                                  'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    #  info_business 商户
    delete_info_business = 'DELETE b FROM info_business b ' \
                           'JOIN info_employee e ON b.creator=e.user_id ' \
                           'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # ----------------------------------------------------
    # 渣土车相关
    delete_info_truck_capture_record = 'DELETE cr FROM info_truck_capture_record cr ' \
                                       'JOIN info_employee e ON cr.creator=e.user_id ' \
                                       'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    delete_info_report_record = 'DELETE rr FROM info_report_record rr  ' \
                                'JOIN info_employee e ON rr.creator=e.user_id ' \
                                'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    delete_info_truck_record = 'DELETE tr FROM info_truck_record tr ' \
                               'JOIN info_employee e ON tr.creator=e.user_id ' \
                               'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # ----------------------------------------------------------------
    # 文明工地相关表
    # info_related_unit
    delete_info_related_unit = 'DELETE ru FROM info_related_unit ru ' \
                               'JOIN info_project p ON ru.project_id=p.id ' \
                               'WHERE p.project_name = "测试现建项目_请勿删除"'
    # 项目关联视频源
    delete_info_r_project_resource = 'DELETE pr FROM info_r_project_resource pr ' \
                                     'JOIN info_project p ON pr.project_id=p.id ' \
                                     'WHERE p.project_name = "测试现建项目_请勿删除"'
    # 删除建筑工地
    delete_info_construction = 'DELETE FROM info_construction WHERE project_name LIKE "%测试现建项目_请勿删除%"'

    # info_project 项目表
    delete_info_project = 'DELETE FROM info_project WHERE project_name = "测试现建项目_请勿删除"'

    # -------------------------------------------------------------

    # ——————————————————————————————————————————————————————————————————————————————————————
    # 考勤相关表
    # 排班表
    # 排班考勤记录表
    delete_info_duty_attendance = 'DELETE a FROM info_duty_attendance a ' \
                                  'JOIN info_employee e ON a.user_id=e.user_id ' \
                                  'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 排班业务表
    delete_info_duty = 'DELETE d FROM info_duty d ' \
                       'JOIN info_employee e ON d.creator=e.user_id ' \
                       'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # -------------------------
    # 请假记录表
    # 假期配置相关表
    # 用户假期余额表
    delete_info_leave_config_user_balance = 'DELETE cub FROM info_leave_config_user_balance cub ' \
                                            'JOIN info_leave_config c ON cub.config_id=c.id ' \
                                            'JOIN info_employee e ON c.creator=e.user_id ' \
                                            'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    # 请假规则使用用户范围
    delete_info_leave_config_user = 'DELETE cu FROM info_leave_config_user cu ' \
                                    'JOIN info_leave_config c ON cu.config_id=c.id ' \
                                    'JOIN info_employee e ON c.creator=e.user_id ' \
                                    'WHERE e.username="kobekq1" OR e.username="kobekq2";'

    # 假期配置表
    delete_info_leave_config = 'DELETE c FROM info_leave_config c ' \
                               'JOIN info_employee e ON c.creator=e.user_id ' \
                               'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 请假业务表
    # 假期明细表
    delete_info_leave_detail = 'DELETE ld FROM info_leave_detail ld ' \
                               'JOIN info_employee e ON ld.user_id=e.user_id ' \
                               'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    # 请假业务表
    delete_info_leave = 'DELETE l FROM info_leave l ' \
                        'JOIN info_employee e ON l.creator=e.user_id ' \
                        'WHERE e.username="kobekq1" OR e.username="kobekq2";'

    # --------------------------
    # 加班相关业务表
    # 加班明显表
    delete_info_overtime_detail = 'DELETE d FROM info_overtime_detail d ' \
                                  'JOIN info_employee e ON d.user_id=e.user_id ' \
                                  'WHERE e.username="kobekq1" OR e.username="kobekq2";'

    # 加班业务表
    delete_info_overtime_apply = 'DELETE a FROM info_overtime_apply a ' \
                                 'JOIN info_employee e ON a.user_id=e.user_id ' \
                                 'WHERE e.username="kobekq1" OR e.username="kobekq2";'

    # -------------------------------
    # 外勤相关业务表
    # 外勤明细表
    delete_info_fieldwork_detail = 'DELETE fd FROM info_fieldwork_detail fd ' \
                                   'JOIN info_employee e ON fd.user_id=e.user_id ' \
                                   'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    # 外勤业务表
    delete_info_fieldwork = 'DELETE f FROM info_fieldwork f ' \
                            'JOIN info_employee e ON f.user_id=e.user_id ' \
                            'WHERE e.username="kobekq1" OR e.username="kobekq2";'

    # -------------------
    # 补卡相关表测试
    # 补卡打卡记录表
    delete_info_clock_in = 'DELETE ci FROM info_clock_in ci ' \
                           'JOIN info_employee e ON ci.user_id=e.user_id ' \
                           'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    # 补卡业务数据表
    delete_info_remedy_clock_in = 'DELETE ci FROM info_remedy_clock_in ci ' \
                                  'JOIN info_employee e ON ci.user_id=e.user_id ' \
                                  'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    # 考勤附件表
    delete_info_attendance_attachment = 'DELETE FROM info_attendance_attachment WHERE file_name="put_photo.jpg"'

    # -----------
    # 考勤相关表
    # 考勤组时间段
    delete_info_work_group_time = 'DELETE wgt FROM info_work_group_time wgt ' \
                                  'JOIN info_work_group wg ON wgt.work_group_id=wg.id ' \
                                  'JOIN info_employee e ON wg.creator=e.user_id ' \
                                  'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    # 考勤组适用人员
    delete_info_work_group_user = 'DELETE wgu FROM info_work_group_user wgu ' \
                                  'JOIN info_employee e ON wgu.user_id=e.user_id ' \
                                  'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    # 考勤组
    delete_info_work_group = 'DELETE wg FROM info_work_group wg ' \
                             'JOIN info_employee e ON wg.creator=e.user_id ' \
                             'WHERE e.username="kobekq1" OR e.username="kobekq2";'
    # 考勤记录
    delete_info_attendance_record = 'DELETE ar FROM info_attendance_record ar ' \
                                    'JOIN info_employee e ON ar.user_id=e.user_id ' \
                                    'WHERE e.username="kobekq1" OR e.username="kobekq2";'

    # ------------------------------------
    # 会议记录相关的表
    # 删除会议相关的数据
    delete_info_meeting_notice_annex = 'DELETE re FROM info_meeting_notice_annex re' \
                                       ' JOIN info_meeting_notice notice ' \
                                       'ON notice.`id` = re.`meeting_id` ' \
                                       'JOIN info_employee em  ' \
                                       'ON em.`user_id` = notice.`publish_user_id` ' \
                                       'WHERE em.`username` = "kobekq1";'
    # 删除会议的通知记录
    delete_info_meeting_notice_reply = 'DELETE re FROM info_meeting_notice_reply re' \
                                       ' JOIN info_meeting_notice notice' \
                                       ' ON notice.`id` = re.`meeting_id` ' \
                                       'JOIN info_employee em ' \
                                       'ON em.`user_id` = notice.`publish_user_id` ' \
                                       'WHERE em.`username` = "kobekq1"'
    # 删除会议列表
    delete_info_meeting_notice = 'DELETE notice FROM info_meeting_notice notice' \
                                 ' JOIN info_employee em ' \
                                 'ON em.`user_id` = notice.`publish_user_id` ' \
                                 'WHERE em.`username` = "kobekq1"'

    # 删除单兵装备
    delete_info_individual_equipment = 'DELETE FROM info_individual_equipment WHERE equipment_name LIKE "%autoTest%"'

    # 删除视频源
    delete_info_video_resource = ' DELETE FROM info_video_resource WHERE info_video_resource.name = "测试新建视频源_请勿删除"'
    # 删除视频源分组
    delete_info_video_resource_group = ' DELETE FROM info_video_resource_group ' \
                                       'WHERE info_video_resource_group.name = "测试新建分组_请勿删除"'

    # 删除执法任务
    # 删除执法任务
    delete_info_enterprise_task_log = 'DELETE etl FROM info_enforce_task_log etl ' \
                                      'JOIN info_enforce_task et  ON etl.task_id=et.task_id ' \
                                      'JOIN info_employee e ON et.creator=e.user_id ' \
                                      'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    delete_info_enforce_task = 'DELETE et FROM info_enforce_task et ' \
                               'JOIN info_employee e ON et.creator=e.user_id ' \
                               'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # 删除执法督察
    # 执法督察相关附件
    delete_info_supervision_annex = 'DELETE sa FROM info_supervision_annex sa ' \
                                    'JOIN  info_supervision  s ON sa.supervision_id=s.id ' \
                                    'JOIN info_employee e ON s.creator=e.user_id ' \
                                    'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 执法督察节点人员记录
    delete_info_supervision_operator = 'DELETE so FROM info_supervision_operator so ' \
                                       'JOIN  info_supervision  s ON so.supervision_id=s.id ' \
                                       'JOIN info_employee e ON s.creator=e.user_id ' \
                                       'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # 执法督察流程信息记录
    delete_info_supervision_document = 'DELETE sd FROM info_supervision_document sd ' \
                                       'JOIN  info_supervision  s ON sd.supervision_id=s.id ' \
                                       'JOIN info_employee e ON s.creator=e.user_id ' \
                                       'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 配置关联用户表
    delete_info_supervision_category_relation_user = 'DELETE scru FROM info_supervision_category_relation_user scru ' \
                                                     'JOIN  info_supervision_category  sc  ' \
                                                     'ON scru.supervision_category_id=sc.id ' \
                                                     'JOIN info_employee e ON sc.creator=e.user_id ' \
                                                     'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 督察数据表
    delete_info_supervision = 'DELETE s FROM  info_supervision  s ' \
                              'JOIN info_employee e ON s.creator=e.user_id ' \
                              'WHERE e.username="kobekq1" OR e.username="kobekq2"'
    # 督察配置表
    delete_info_supervision_category = 'DELETE sc FROM info_supervision_category  sc ' \
                                       'JOIN info_employee e ON sc.creator=e.user_id ' \
                                       'WHERE e.username="kobekq1" OR e.username="kobekq2"'

    # 删除字典项
    delete_info_dict_manage = 'DELETE FROM info_dict_manage WHERE module_name LIKE "修改%"'
    # 删除企业
    # 删除企业关联视频源
    delete_info_enterprise_resource = 'DELETE r FROM info_enterprise_resource r ' \
                                      'JOIN info_enterprise e ON r.enterprise_id = e.id ' \
                                      'WHERE e.name="UI新建单位" OR e.name="测试新建企业_请勿删除"'
    # 删除企业
    delete_info_enterprise = 'DELETE  FROM info_enterprise WHERE NAME IN ("UI新建单位", "测试新建企业_请勿删除")'


def return_delete_list():
    '''
    返回需要删除的数据列表
    :return:
    '''
    # 获取当期文件的所有属性
    return [getattr(DeleteSql(), sql) for sql in
            filter(lambda name: name.startswith('delete'), DeleteSql.__dict__.keys())]


if __name__ == '__main__':
    for i in return_delete_list():
        print(i)
